package com.woniuxy.microretailserver.controller;

import com.github.pagehelper.PageInfo;
import com.woniuxy.microretailserver.bean.GoodsOrderBean;
import com.woniuxy.microretailserver.bean.PageRequest;
import com.woniuxy.microretailserver.service.IGoodsOrderService;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author chenhu
 * 商品财务交易明细控制层
 */
@RestController
@RequestMapping("/fin")
public class FinDetailsController {

    @Resource
    private IGoodsOrderService goodsOrderServiceImpl;

    /**
     * 展示财务交易明细
     * @param request
     * @return
     */
    @RequestMapping(value = "/findGoodsPay",produces = MediaType.APPLICATION_JSON_VALUE)
    public PageInfo<GoodsOrderBean> findAllGoodsOrderPay(PageRequest request){
        GoodsOrderBean goodsOrderBean = new GoodsOrderBean();
        PageInfo<GoodsOrderBean> allGoodsOrderPay = goodsOrderServiceImpl.findAllGoodsOrderPay(request, goodsOrderBean);
        System.out.println(allGoodsOrderPay);
        return allGoodsOrderPay;
    }

    /**
     * 模糊查询财务交易明细
     * @param request
     * @param goodsOrderBean
     * @return
     */
    @GetMapping(value = "/findBy",produces = MediaType.APPLICATION_JSON_VALUE)
    public PageInfo<GoodsOrderBean> findBy(PageRequest request,GoodsOrderBean goodsOrderBean){
        PageInfo<GoodsOrderBean> allGoodsOrderPay = goodsOrderServiceImpl.findAllGoodsOrderPay(request, goodsOrderBean);
        return allGoodsOrderPay;
    }
}
